/*    */ package org.flashzlm.tools.shifa.impl;
/*    */ 
/*    */ import java.util.Random;
/*    */ import org.flashzlm.tools.shifa.ZhanShiFa;
/*    */ 
/*    */ public class DaYanFa
/*    */   implements ZhanShiFa
/*    */ {
/*    */   public int qiYao(long seed)
/*    */   {
/* 12 */     int yuShu = yiBian(49, seed);
/* 13 */     yuShu = yiBian(yuShu, seed);
/* 14 */     yuShu = yiBian(yuShu, seed);
/*    */ 
/* 16 */     return (yuShu / 4);
/*    */   }
/*    */ 
/*    */   public int yiBian(int total, long seed) {
/* 20 */     Random r = new Random(seed);
/* 21 */     int left = 0;
/*    */     do
/* 23 */       left = r.nextInt(total + 1);
/* 24 */     while ((left == 0) || (left == total));
/*    */ 
/* 26 */     int right = total - left - 1;
/*    */ 
/* 28 */     int leftMod = left % 4;
/* 29 */     if (leftMod == 0) leftMod = 4;
/* 30 */     int rightMod = right % 4;
/* 31 */     if (rightMod == 0) rightMod = 4;
/*    */ 
/* 33 */     total -= leftMod + rightMod + 1;
/*    */ 
/* 35 */     return total;
/*    */   }
/*    */ }
